<template>
	<view class="ue-content">
		<view v-html="detailInfo.draftContent"></view>
	</view>
</template>

<script setup>
import apis from '@/apis'
import axios from '@/apis/request'
import { onLoad } from '@dcloudio/uni-app'
import { computed, ref } from 'vue'

const productId = ref('')
const type = ref('')
onLoad(params => {
	console.log('进入了啊啊 啊', params)
	productId.value = params.productId
	type.value = params.type
	loadData()
})

const detailInfo = ref({
	content: '',
	productId: '',
	draftContent: '',
	fileList: []
})

const url = computed(() => {
	switch (type.value) {
		case '1':
			return apis.product.selectJxfProductOutlineByProductId
		case '2':
			return apis.product.selectJxfProductClearanceByProductId
		case '3':
			return apis.product.selectJxfProductOperationByProductId
		default:
			return ''
	}
})

function loadData() {
	console.log('url', url.value)
	console.log('productId.value', productId.value)
	console.log('import.meta.env.VITE_API_URL', import.meta.env.VITE_API_URL)
	axios
		.get(url.value, {
			productId: productId.value
		})
		.then(res => {
			detailInfo.value = res || {}
		})
}
</script>

<style lang="scss">
page {
	background: #ffffff;
}

.ue-content {
	padding: 30rpx;
}
</style>
